module.exports = function(sequelize, DataTypes) {
  var Conversation = sequelize.define('Conversation', {
    id : {type : DataTypes.INTEGER, primaryKey:true, autoIncrement:true},
    user_id: {
        type: DataTypes.INTEGER,
        references: "Users",
        referencesKey: 'id'
    },
    title:    DataTypes.STRING,
    started:  DataTypes.DATE
  }, {
    classMethods: {
      associate: function(models) {
        Conversation.belongsTo(models.User);
        Conversation.hasMany(models.User, {as:'Participant', through:'conversation_participants'});
        Conversation.hasMany(models.Note);
      },
    }
  });
 
  return Conversation
}